package com.xsp.annotation;

import com.xsp.entity.User;

/**
 * @author xsp
 * @date 2024/1/27
 * @desc 测试打在了MyAnnotation注解的类上，是否获取到注解的信息
 */
public class Test {
    public static void main(String[] args) {
        Class<User> userClass = User.class;
        MyAnnotation annotation = userClass.getAnnotation(MyAnnotation.class);
        if (annotation!=null) {
            System.out.println(annotation.name());
            System.out.println(annotation.age());
        }else{
            System.out.println("未获取到注解信息");
        }
    }
}
